package cn.edu.ptu.jobfairs.web;

import cn.edu.ptu.jobfairs.basic.bo.Position;
import cn.edu.ptu.jobfairs.basic.common.Result;
import cn.edu.ptu.jobfairs.basic.dto.request.IdDTO;
import cn.edu.ptu.jobfairs.services.PositionService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by Lin Chenxiao on 2020-08-25
 **/
@RestController
@RequestMapping("/p")
public class PositionController {
    @Resource
    private PositionService positionService;


    @PostMapping("/list1")
    public Result list1() {
        return positionService.listPosition();
    }

    @PostMapping("/list2")
    public Result list2() {
        return positionService.listAuthPosition();
    }

    @PostMapping("/add")
    public Result add(Position position) {
        return positionService.addPosition(position);
    }

    @PostMapping("/edit")
    public Result edit(Position position) {
        return positionService.editPosition(position);
    }

    @PostMapping("/del")
    public Result del(IdDTO idDTO) {
        return positionService.delPosition(idDTO);
    }

}
